﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SportsStore.Repository.Interfaces;
using Repository;
using SportsStore.Model;
using SportsStore.Repository.Contexts;

namespace SportsStore.Repository.Repositories
{
  public class CategoryRepository : BaseEfRepository<Category>, ICategoryRepository
  {
    public CategoryRepository(string connectionString)
          : base(new SportsStoreDbContext(connectionString))
    {
    }

    public List<string> GetCategories()
    {
      return Entities.Select(p => p.Name).Distinct().OrderBy(x => x).ToList();
    }
  }
}
